package com.yaDuo.common.request

import retrofit2.http.GET

/**
 * @author YaDuo
 * time 2024-11-20 20:22
 * 负责网络接口配置,包括请求地址，请求头，请求方式，参数等所有配置
 */
interface NetApi {

    // 获取分类
    @GET("/shop/category/list")
    suspend fun getCategoryList(): TicketUnionResponse<List<CategoryDataBean>>

    // 获取推荐的物料
    @GET("/shop/material/list")
    suspend fun getMaterialList(): TicketUnionResponse<List<MaterialDataBean>>
}

/**
 * 阳光沙滩的通用响应体
 * 核心内容在data里
 */
data class TicketUnionResponse<T>(
    val success: Boolean,
    val code: Long,
    val msg: String,
    val data: T
)

/**
 * @author YaDuo
 * time 2024-11-24 00:15
 * 分类里的Data
 * 记录了每个详细分类
 *
 * [@Field]和[@SerializedName]都是用来指定
 * JSON字段和Kotlin数据类属性之间的映射关系的注解
 */
data class CategoryDataBean(
    var id: Long,
    val word: String,
    val ord: Int,
    val parentId: String,
    val color: String,
    val icon: String,
    val enable: String,
    val clickCount: Int,
    val createTime: String,
    val updateTime: String,
    val subCategoryList: List<SubCategoryDataBean>? =
        null
)

/**
 * @author YaDuo
 * time 2024-11-24 00:27
 * 详细分类[CategoryDataBean]里每个分类下的子分类
 * 如：服饰鞋包[CategoryDataBean]里包含了男装和女装[SubCategoryDataBean]
 */
data class SubCategoryDataBean(
    var id: String,
    val word: String,
    val ord: Int,
    val parentId: String,
    val color: String,
    val icon: String,
    val enable: String,
    val clickCount: Int,
    val createTime: String,
    val updateTime: String
)

/**
 * @author YaDuo
 * time 2025-01-02 17:40
 * 物料分类Data
 */
data class MaterialDataBean(
    val materialName: String,
    val materialId: Long,
    val materialType: Int,
    val subject: Int,
    val startTime: Long,
    val endTime: Long,
)
